package org.zoomdev.zoom.dao.adapters.result;

import org.zoomdev.zoom.dao.adapters.ResultSetAdapter;

import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;

public class Date2LocalDateResultSetAdapter implements ResultSetAdapter<LocalDate> {
    @Override
    public LocalDate getObject(ResultSet rs, int index) throws SQLException {
        Date date = rs.getDate(index);
        if (date == null) {
            return null;
        }
        return date.toLocalDate();
    }
}
